package com.javasoft.controller.LCB;

import com.javasoft.entity.XGX.Question;
import com.javasoft.service.LCB.RemoveQueService;
import com.javasoft.service.LCB.RemoveQueServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/LCB")
public class RemoveQueController {

    @Autowired
    private RemoveQueService removeQueService;

    /**
     * 添加考题并进行去重检查
     * @param question
     * @return 是否成功添加
     */
    @PostMapping("/removeQue")
    public String addQuestion(@RequestBody Question question) {
        if (removeQueService.addQuestionWithDuplicateCheck(question)) {
            return "题目成功添加!";
        } else {
            return "题目添加失败：试题重复存在。";
        }
    }
}



